package com.lincoln.jenkins.test.replys;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

/**
 * <param name="url">收到好友验证时附带的</param>
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class AgreeJoin implements Reply {
    private String url;

    public static AgreeJoin agree(String url) {
        AgreeJoin agreeJoin = new AgreeJoin();
        agreeJoin.url = url;
        return agreeJoin;
    }

    @Override
    public String genUrl() {
        try {
            return URLEncoder.encode("&url=" + url, "UTF-8");
        } catch (UnsupportedEncodingException e) {
            return "";
        }
    }
}
